<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>不可签署日期</title>
    <jsp:include page="../../import.jsp" flush="true" />
</head>
<script type="text/javascript">
    var grid = null;
    var pageInTab = null;
    var pageInApp = {};
    var loadedTabs=[];
    $(function () {
        initGrid();
        initTab()
        $("#searchBar").ligerForm();

        $("#searchBtn").click(function(event) {
            var form = new liger.get("searchBar");
            var data = form.getData();
            for (name in data){
                grid.setParm(name,data[name]);
            };
            grid.reload();
        });
    });

    //初始化列表
    function initGrid(){
        var params = {};
        $("#grid").ligerGrid({
            url: '<%=path%>/institution/nosigndate/nosigndatelist.do',
            method : 'get',
            parms:params,
            columns: [

                { display: '机构名称', name: 'insName', minWidth: 80 ,align:'left',enabledSort:true},
                { display: '不可签署日期', name: 'noSignDate', minWidth: 60,align:'left',enabledSort:true},
                {
                    display: '操作',
                    isSort: false,
                    width: 200,
                    align:'left',
                    render: function (rowdata, rowindex, value){
                        var h="";
                                h = '<a class="sq-button-hasicon" href="javascript:modifyBtn(';
                                h += "'" + rowdata.id + "'";
                                h += ')"><i class="sqBtnIco_4"></i>修改</a>';
                        return h;
                    }
                }
            ],
            pageSize:10,
            root:'rows',
            record:'total',
            hideLoadButton : true,
            width: '100%',
            height:'100%',
            heightDiff:-2,
            checkbox:true,
            allowUnSelectRow: true,
            alternatingRow: true,
            rownumbers:true,
            enabledEdit: true,
            isSingleCheck:true
        });
        grid = liger.get("grid");
        grid.setHeight(500);

    }

    //初始化Tab页签
    function initTab(){
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            onBeforeSelectTabItem: function (tabid) {
                switch (tabid) {
                    case "tabA":
                        // console.log("aaaa")
                        $("#searchBtn").click();//不可签署日期列表刷新
                        break;
                    case "tabB":
                        // console.log("bbbb")
                        // console.log($("#tabB").contents().find(".noSignTimeSearchBtn"))
                        // $(window.frames["tabB"].document).find(".noSignTimeSearchBtn").click();
                        $("#tabB").contents().find(".noSignTimeSearchBtn").click()
                        break;
                }

            },
            onAfterSelectTabItem: function (tabid) {
                if (loadedTabs.indexOf(tabid) < 0) {
                    loadedTabs.push(tabid);
                    switch (tabid) {
                        case "tabA":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/institution/nosigndate/nosigndatelist.do");
                            break;
                        case "tabB":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/institution/nosigndate/timelistpage.do");
                            break;
                    }
                }
                SetIframe_height();
            }
        });
        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
    };
    //选择客户页面
    function addBtn() {
        $.ligerDialog.open({
            title: '新增',
            height: 160,
            width: 500,
            url: '<%=path%>/institution/nosigndate/nosigndateaddpage.do'
        });
    }

    //编辑界面
    function modifyBtn(id) {
        $.ligerDialog.SQopen({
            title: '编辑',
            height: 400,
            width: 800,
            url: '<%=path%>/institution/nosigndate/nosigndateeditpage.do?id=' +id
        });
    }

</script>

<body class="iframeBody">
<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <div tabid="tabA" title="不可签署日期" lselected="true">
            <div class="searchArea">
                <form id="searchBar">
                    <div class="fieldset1 clearFix">
                        <div class="fieldBox col_33">
                            <div class="label">机构名称</div>
                            <div class="field">
                                <input name="insName" id="insName" type="text" class="ui-textbox" value="">
                            </div>
                        </div>
                        <div class="clearFix"></div>
                        <div class="btnsBox">
                            <span id="searchBtn"  class="sq-button sq-button-round">查询</span>
                            <span id="addBtn" onclick="addBtn();" class="sq-button sq-button-round">新增</span>
                        </div>
                    </div>
                </form>
                <div id="grid" class="sq-grid"></div>
            </div>
        </div>
        <div tabid="tabB" title="不可签署时间" id="tabBId">
            <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
        </div>
    </div>
</div>
</body>
</html>